#ifndef PNDP_STRUCT_H_
#define PNDP_STRUCT_H_

#include <stdio.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <string.h>


#define MAX_ITERACOES 4000
#define MAX_TAM_POOL  10
#define MAX_NOS       500
#define MAX_ARESTAS   (MAX_NOS * (MAX_NOS - 1) / 2)
#define MAX_DEMANDA   MAX_NOS * 10
#define MAIS_INFINITO 65000



typedef struct aresta {
  int origem;
  int destino;
  int id;
} t_aresta;


int incidencia[MAX_NOS + 1][MAX_NOS + 1];
int ids[MAX_NOS + 1][MAX_NOS + 1];
t_aresta demanda[MAX_DEMANDA + 1];

t_aresta solucao[MAX_DEMANDA + 1][3];
t_aresta melhor_solucao[MAX_DEMANDA + 1][3];

t_aresta pool_solucao[MAX_TAM_POOL + 1][MAX_DEMANDA + 1][3];
int pool_custo[MAX_TAM_POOL + 1];

int Ler_Arquivo_Arestas(char *arq, int *nos, int *arestas, int incidencia[MAX_NOS + 1][MAX_NOS + 1]);

int Ler_Demandas(char *arq, t_aresta demanda[MAX_DEMANDA + 1]);

void Inicia_Solucao(int nnos, int ndemandas, int num_vezes[MAX_NOS + 1][MAX_NOS + 1], t_aresta solucao[MAX_DEMANDA + 1][3]);
/*
int GulosoRandomizadoDemanda(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3],constBusc *cB);

void BuscaLocalDemanda(t_aresta solucao[MAX_DEMANDA + 1][3], int *custo, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int nnos, int *semente,constBusc *cB);
*/
/*

typedef struct {
t_aresta demanda[MAX_DEMANDA + 1];
t_aresta solucao[MAX_DEMANDA + 1][3];
PoolMine *pool;
Padroes *padroes;
int nnos; 
int ndemandas;
int incidencia[MAX_NOS + 1][MAX_NOS + 1];
int num_vezes[MAX_NOS + 1][MAX_NOS + 1];
int *semente;
int it;
int *custo; 
int limit;
int *conta_parada;
int *pronto;
int *qnt_mines;
int qnt_padroes;
int min_suporte;
}constBusc;
*/





/*
int GRASPDemanda(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3], int num_it,int min_suporte,int qnt_padroes,int pool_limit,double mine_limits,double *t_miner,int *qnt_mines);

int GRASP_PRB(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3], t_aresta melhor_solucao[MAX_DEMANDA + 1][3], t_aresta pool_solucao[MAX_TAM_POOL + 1][MAX_DEMANDA + 1][3], int pool_custo[MAX_TAM_POOL + 1], int num_it);

int GRASP_PRM(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3], t_aresta melhor_solucao[MAX_DEMANDA + 1][3], t_aresta pool_solucao[MAX_TAM_POOL + 1][MAX_DEMANDA + 1][3], int pool_custo[MAX_TAM_POOL + 1], int num_it);

int GRASP_PRF(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3], t_aresta melhor_solucao[MAX_DEMANDA + 1][3], t_aresta pool_solucao[MAX_TAM_POOL + 1][MAX_DEMANDA + 1][3], int pool_custo[MAX_TAM_POOL + 1], int num_it);

int GRASP_PRBF(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3], t_aresta melhor_solucao[MAX_DEMANDA + 1][3], t_aresta pool_solucao[MAX_TAM_POOL + 1][MAX_DEMANDA + 1][3], int pool_custo[MAX_TAM_POOL + 1], int num_it);

int GRASP_S(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3], int alvo);

int GRASP_PRB_S(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3], t_aresta melhor_solucao[MAX_DEMANDA + 1][3], t_aresta pool_solucao[MAX_TAM_POOL + 1][MAX_DEMANDA + 1][3], int pool_custo[MAX_TAM_POOL + 1], int alvo);

int GRASP_PRM_S(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3], t_aresta melhor_solucao[MAX_DEMANDA + 1][3], t_aresta pool_solucao[MAX_TAM_POOL + 1][MAX_DEMANDA + 1][3], int pool_custo[MAX_TAM_POOL + 1], int alvo);

int GRASP_PRF_S(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3], t_aresta melhor_solucao[MAX_DEMANDA + 1][3], t_aresta pool_solucao[MAX_TAM_POOL + 1][MAX_DEMANDA + 1][3], int pool_custo[MAX_TAM_POOL + 1], int alvo);

int GRASP_PRBF_S(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3], t_aresta melhor_solucao[MAX_DEMANDA + 1][3], t_aresta pool_solucao[MAX_TAM_POOL + 1][MAX_DEMANDA + 1][3], int pool_custo[MAX_TAM_POOL + 1], int alvo);
*/

/*
int GRASP_PRBF_MINE(int nnos, int ndemandas, t_aresta demanda[MAX_DEMANDA + 1], int incidencia[MAX_NOS + 1][MAX_NOS + 1], int num_vezes[MAX_NOS + 1][MAX_NOS + 1], int *semente, t_aresta solucao[MAX_DEMANDA + 1][3], t_aresta melhor_solucao[MAX_DEMANDA + 1][3], t_aresta pool_solucao[MAX_TAM_POOL][MAX_DEMANDA + 1][3], int pool_custo[MAX_TAM_POOL], int num_it,int min_suporte,int qnt_padroes,int pool_limit,double mine_limit,double *t_miner,int *qnt_mines);
*/

void Tempo_CPU_Sistema(double *seg_CPU_total, double *seg_sistema_total);
#endif
